package com.itwill.ecom.member;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository("memberService")
public class MemberServiceImpl implements MemberService {

	@Autowired
	private MemberDao memberDao;

	public MemberServiceImpl() {
		super();
		System.out.println("△MemberServiceImpl 생성자△");
	}

	// MemberBeans 생성
	@Override
	public void createMember(MemberBeans memberBeans) {
		memberDao.createMember(memberBeans);
	}

	// MemberBeans 찾기
	@Override
	public MemberBeans getMember(MemberBeans memberBeans) {
		return memberDao.getMember(memberBeans);
	}

	// MemberBeans 수정
	@Override
	public void updateMember(MemberBeans memberBeans) {
		memberDao.updateMember(memberBeans);
	}

	// MemberBeans 삭제
	@Override
	public void deleteMember(MemberBeans memberBeans) {
		memberDao.deleteMember(memberBeans);

	}

	// 아이디로 멤버 찾기
	@Override
	public MemberBeans getMemberById(String id) {
		MemberBeans memberBeans;
		try{
			memberBeans = memberDao.getMemberById(id); 
		}
		catch(Exception e){
			memberBeans = null;
		}
		return memberBeans;
	}

	// 전체 멤버리스트 찾기
	@Override
	public List<MemberBeans> getMemberList() {
		return memberDao.getMemberList();
	}

	// 전체 멤버 삭제
	@Override
	public void deleteMemberList() {
		memberDao.deleteMemberList();
	}

	

}
